<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>聊天互动 - Web3 AI数字人NFT交互平台</title>
    <link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
    <style>
        body {
            background: linear-gradient(135deg, #0f0f2d 0%, #1a1a40 100%);
            color: white;
            font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, sans-serif;
            min-height: 100vh;
            height: 100%;
            margin: 0;
            padding: 0;
            overflow: hidden;
        }
        .chat-container {
            height: 100vh;
            max-height: -webkit-fill-available;
            display: flex;
            flex-direction: column;
        }
        .chat-header {
            padding: 15px 20px;
            background: rgba(15, 15, 45, 0.8);
            backdrop-filter: blur(10px);
            border-bottom: 1px solid rgba(255, 255, 255, 0.1);
            display: flex;
            align-items: center;
            justify-content: space-between;
        }
        .ai-info {
            display: flex;
            align-items: center;
        }
        .ai-avatar {
            width: clamp(2rem, 8vw, 2.5rem);
            height: clamp(2rem, 8vw, 2.5rem);
            border-radius: 50%;
            overflow: hidden;
            margin-right: 0.75rem;
            border: 2px solid #7c3aed;
        }
        .ai-name {
            font-weight: bold;
            font-size: clamp(0.875rem, 4vw, 1rem);
        }
        .ai-personality {
            font-size: clamp(0.75rem, 3vw, 0.875rem);
            color: #a78bfa;
        }
        .storage-indicator {
            background: rgba(255, 255, 255, 0.05);
            border-radius: 20px;
            padding: 5px 10px;
            font-size: 12px;
            display: flex;
            align-items: center;
        }
        .storage-bar {
            width: 50px;
            height: 6px;
            background: rgba(255, 255, 255, 0.1);
            border-radius: 3px;
            margin: 0 8px;
            overflow: hidden;
        }
        .storage-progress {
            height: 100%;
            width: 65%;
            background: linear-gradient(90deg, #7c3aed, #3b82f6);
            border-radius: 3px;
        }
        .chat-messages {
            flex: 1;
            overflow-y: auto;
            padding: clamp(0.5rem, 3vw, 1rem);
            -webkit-overflow-scrolling: touch;
            scroll-behavior: smooth;
        }
        .message {
            margin-bottom: clamp(0.75rem, 3vw, 1rem);
            max-width: min(85%, 32rem);
            display: flex;
            flex-direction: column;
        }
        .message-content {
            padding: clamp(0.5rem, 3vw, 1rem);
            border-radius: 1.125rem;
            font-size: clamp(0.875rem, 4vw, 1rem);
            line-height: 1.5;
            position: relative;
            word-wrap: break-word;
            max-width: fit-content;
            min-width: 60px;
            transition: all 0.3s ease;
        }
        .message-user {
            align-self: flex-end;
            display: flex;
            flex-direction: column;
            align-items: flex-end;
        }
        .message-ai {
            align-self: flex-start;
        }
        .message-content {
            padding: 12px 16px;
            border-radius: 18px;
            font-size: 14px;
            line-height: 1.4;
            position: relative;
        }
        .message-user .message-content {
            background: #7c3aed;
            border-bottom-right-radius: 4px;
        }
        .message-ai .message-content {
            background: rgba(255, 255, 255, 0.05);
            border: 1px solid rgba(255, 255, 255, 0.1);
            border-bottom-left-radius: 4px;
        }
        .message-time {
            font-size: 10px;
            color: rgba(255, 255, 255, 0.5);
            margin-top: 5px;
            align-self: flex-end;
        }
        .message-ai .message-time {
            align-self: flex-start;
        }
        .message-image {
            max-width: 200px;
            border-radius: 12px;
            margin-top: 5px;
        }
        .chat-input {
            padding: clamp(0.75rem, 3vw, 1rem);
            background: rgba(15, 15, 45, 0.8);
            backdrop-filter: blur(10px);
            border-top: 1px solid rgba(255, 255, 255, 0.1);
            position: sticky;
            bottom: 0;
        }
        .input-container {
            display: flex;
            align-items: center;
            background: rgba(255, 255, 255, 0.05);
            border: 1px solid rgba(255, 255, 255, 0.1);
            border-radius: 1.5rem;
            padding: clamp(0.5rem, 2vw, 0.75rem) clamp(0.75rem, 3vw, 1rem);
        }
        .input-field {
            flex: 1;
            background: transparent;
            border: none;
            color: white;
            padding: 0.5rem 0;
            outline: none;
            font-size: clamp(0.875rem, 4vw, 1rem);
        }
        .input-actions {
            display: flex;
            align-items: center;
            gap: clamp(0.25rem, 2vw, 0.5rem);
        }
        .input-action {
            width: clamp(2.25rem, 9vw, 2.5rem);
            height: clamp(2.25rem, 9vw, 2.5rem);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #a78bfa;
            background: rgba(124, 58, 237, 0.1);
            border: 1px solid rgba(124, 58, 237, 0.3);
        }
        .send-button {
            background: linear-gradient(135deg, #7c3aed 0%, #3b82f6 100%);
            color: white;
        }
        .typing-indicator {
            display: flex;
            align-items: center;
            margin-top: 5px;
            margin-left: 10px;
            font-size: 12px;
            color: #a78bfa;
        }
        .typing-dot {
            width: 4px;
            height: 4px;
            border-radius: 50%;
            background: #a78bfa;
            margin-right: 3px;
            animation: typing 1.5s infinite ease-in-out;
        }
        .typing-dot:nth-child(1) { animation-delay: 0s; }
        .typing-dot:nth-child(2) { animation-delay: 0.2s; }
        .typing-dot:nth-child(3) { animation-delay: 0.4s; }
        @keyframes typing {
            0%, 60%, 100% { transform: translateY(0); }
            30% { transform: translateY(-4px); }
        }
        .glow {
            position: fixed;
            width: 200px;
            height: 200px;
            border-radius: 50%;
            filter: blur(80px);
            z-index: -1;
        }
        .glow-1 {
            top: 20%;
            left: 10%;
            background: rgba(124, 58, 237, 0.15);
        }
        .glow-2 {
            bottom: 10%;
            right: 10%;
            background: rgba(59, 130, 246, 0.15);
        }
        
        /* Emoji Click Effect */
        .emoji-effect {
            position: fixed;
            pointer-events: none;
            font-size: 2rem;
            user-select: none;
            animation: emojiPop 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
            z-index: 1000;
        }
        
        @keyframes emojiPop {
            0% {
                opacity: 1;
                transform: translate(-50%, -50%) scale(0.5);
            }
            50% {
                opacity: 0.8;
                transform: translate(-50%, -150%) scale(1.2);
            }
            100% {
                opacity: 0;
                transform: translate(-50%, -200%) scale(0.8);
            }
        }
        /* 文件上传相关样式 */
        .upload-preview {
            position: fixed;
            bottom: 100px;
            left: 50%;
            transform: translateX(-50%);
            background: rgba(15, 15, 45, 0.9);
            border-radius: 12px;
            padding: 12px;
            display: none;
            z-index: 1000;
            border: 1px solid rgba(255, 255, 255, 0.1);
        }
        .upload-preview.active {
            display: block;
        }
        .preview-image {
            max-width: 200px;
            max-height: 200px;
            border-radius: 8px;
            margin-bottom: 10px;
        }
        .preview-video {
            max-width: 200px;
            max-height: 200px;
            border-radius: 8px;
            margin-bottom: 10px;
        }
        .upload-progress {
            width: 100%;
            height: 4px;
            background: rgba(255, 255, 255, 0.1);
            border-radius: 2px;
            margin-bottom: 8px;
            overflow: hidden;
        }
        .upload-progress-bar {
            height: 100%;
            background: linear-gradient(90deg, #7c3aed, #3b82f6);
            width: 0;
            transition: width 0.3s ease;
        }
        .upload-status {
            font-size: 12px;
            color: #a78bfa;
            text-align: center;
        }
        .drop-zone {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(124, 58, 237, 0.1);
            border: 2px dashed #7c3aed;
            display: none;
            align-items: center;
            justify-content: center;
            z-index: 1000;
        }
        .drop-zone.active {
            display: flex;
        }
        .drop-zone-text {
            font-size: 24px;
            color: #7c3aed;
            text-align: center;
            pointer-events: none;
        }
        /* 文件类型错误提示 */
        .file-error {
            position: fixed;
            top: 20px;
            left: 50%;
            transform: translateX(-50%);
            background: rgba(239, 68, 68, 0.9);
            padding: 12px 24px;
            border-radius: 8px;
            color: white;
            font-size: 14px;
            z-index: 1000;
            display: none;
        }
        .file-error.active {
            display: block;
            animation: fadeInOut 3s forwards;
        }
        @keyframes fadeInOut {
            0% { opacity: 0; transform: translate(-50%, -20px); }
            10% { opacity: 1; transform: translate(-50%, 0); }
            90% { opacity: 1; transform: translate(-50%, 0); }
            100% { opacity: 0; transform: translate(-50%, -20px); }
        }
        .input-preview-area {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            padding: 4px;
            min-height: 0;
            max-height: 100px;
            overflow-y: auto;
            margin-bottom: 8px;
        }
        .preview-item {
            position: relative;
            width: 60px;
            height: 60px;
            border-radius: 8px;
            overflow: hidden;
        }
        .preview-item img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
        .preview-item .remove-preview {
            position: absolute;
            top: 2px;
            right: 2px;
            background: rgba(0, 0, 0, 0.5);
            color: white;
            border: none;
            border-radius: 50%;
            width: 20px;
            height: 20px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            font-size: 12px;
        }
    </style>
</head>
<body>
    <div class="glow glow-1"></div>
    <div class="glow glow-2"></div>
    
    <script>
    document.addEventListener('click', function(e) {
        if (e.target.closest('.input-container, .input-actions, .message-content')) return;
        
        const emojis = ['✨', '💫', '⭐️', '🌟', '💝', '💖', '😏', '🌼','🌝','🌏','🌈','🥭', '🇨🇳'];
        const emoji = document.createElement('div');
        emoji.className = 'emoji-effect';
        emoji.textContent = emojis[Math.floor(Math.random() * emojis.length)];
        emoji.style.left = e.pageX + 'px';
        emoji.style.top = e.pageY + 'px';
        document.body.appendChild(emoji);
        
        setTimeout(() => {
            document.body.removeChild(emoji);
        }, 1000);
    });
    </script>
    
    <div class="chat-container">
        <div class="chat-header">
            <div class="ai-info">
                <div class="ai-avatar">
                    <img src="https://images.unsplash.com/photo-1531746020798-e6953c6e8e04?ixlib=rb-1.2.1&auto=format&fit=crop&w=300&q=80" alt="AI Avatar" class="w-full h-full object-cover">
                </div>
                <div>
                    <div class="ai-name">星际探索者</div>
                    <div class="ai-personality">创意型 · 探险家</div>
                </div>
            </div>
            <div class="storage-indicator">
                <i class="fas fa-brain text-purple-400"></i>
                <div class="storage-bar">
                    <div class="storage-progress"></div>
                </div>
                <span>65%</span>
            </div>
        </div>
        
        <div class="chat-messages">
            <!-- AI消息 -->
            <div class="message message-ai">
                <div class="message-content">
                    嗨！我是星际探索者，很高兴认识你！我可以帮你探索宇宙的奥秘，或者聊聊未来科技的发展。你想了解什么呢？
                </div>
                <div class="message-time">09:41</div>
            </div>
        </div>
        
        <div class="chat-input">
            <div class="input-container">
                <div class="input-preview-area"></div>
                <input type="text" class="input-field" placeholder="发送消息给星际探索者...">
                <div class="input-actions">
                    <button class="input-action" id="upload-trigger">
                        <i class="fas fa-image"></i>
                        <input type="file" id="file-input" accept="image/*,video/*" style="display: none;">
                    </button>
                    <button class="input-action">
                        <i class="fas fa-microphone"></i>
                    </button>
                    <button class="input-action send-button">
                        <i class="fas fa-paper-plane"></i>
                    </button>
                </div>
            </div>
        </div>

        <!-- 文件上传预览 -->
        <div class="upload-preview">
            <img class="preview-image" style="display: none;">
            <video class="preview-video" style="display: none;" controls></video>
            <div class="upload-progress">
                <div class="upload-progress-bar"></div>
            </div>
            <div class="upload-status">准备上传...</div>
        </div>

        <!-- 拖拽上传区域 -->
        <div class="drop-zone">
            <div class="drop-zone-text">
                <i class="fas fa-cloud-upload-alt fa-2x mb-2"></i><br>
                拖拽文件到这里上传
            </div>
        </div>

        <!-- 文件类型错误提示 -->
        <div class="file-error">不支持的文件类型，请上传图片或视频文件</div>
    </div>
    
    <script src="chat.js"></script>
</body>
</html>